﻿<div class="spacing-bottom-sm" page-header="AE">
    <div class="row">
        <div class="col-sm-4" ng-show="checkHideCustomer()">
            <input class="form-control" ng-model="customer" placeholder="Customer" ui-keypress="{13:'reSearch(customer)'}"
                   typeahead-on-select="updateCustomer($item)" typeahead="customer as customer.name for customer in getCustomerList($viewValue)" />
        </div>
        <div class="col-sm-2">
            <input class="form-control" ng-model="filters.poNo" placeholder="PO #" type="text" ui-keypress="{13:'reSearch()'}" autofocus />
        </div>
        <div class="col-sm-2">
            <a class="btn btn-info" ui-sref="ae-new" has-access="AECreate" >
                <b class="glyphicon glyphicon-plus"></b> New AE
            </a>
        </div>
    </div>
</div>

<table ng-table="tableParams" class="table table-hover table-bordered ng-table-resizable-columns" ng-visible="$data.length">
    <tr ng-repeat=" aeItem in $data">
        <td data-title="'Id #'" header-class="width5" style="min-width: 120px;"><span class="form-control-static">{{aeItem.id}}</span></td>
        <td data-title="'PO #'" header-class="col-sm-1"><span class="form-control-static">{{aeItem.poNo}}</span></td>
        <td data-title="'AE #'" header-class="col-sm-1"><span class="form-control-static">{{aeItem.aeNo + aeItem.aeNoView}}</span></td>
        <td data-title="'AE Date'" header-class="col-sm-1 "><span class="form-control-static">{{aeItem.aeDate | date: 'dd/MM/yyyy'}}</span></td>
        <td data-title="'Ngày chi'" header-class="col-sm-1 "><span class="form-control-static">{{aeItem.paymentDate |date : 'dd/MM/yyyy'}}</span></td>
        <td data-title="'Số tiền'" header-class="col-sm-2 "><span class="form-control-static">{{aeItem.total | number}}</span></td>
        <td data-title="'Tên khách hàng'" header-class="col-sm-3 width20"><span class="form-control-static">{{aeItem.company.name}}</span></td>
        <td data-title="'Lý do'" header-class="col-sm-3 width15"><span class="form-control-static">{{aeItem.reason}}</span></td>
        <td data-title="'Người đề xuất'" header-class="col-sm-1 "><span class="form-control-static">{{aeItem.user.fullName}}</span></td>
        <td class="text-center" header-class="col-sm-1 width5">
            <a ui-sref="ae-item({id: aeItem.id})" class="btn btn-default">View</a>
        </td>
    </tr>
</table>
<div ng-show="!tableParams.settings().$loading && tableParams.data.length === 0" class="well text-center">No result</div>